# 定义一个有异常的函数
def func01():
    print("这是func01开始")
    num = 1 / 0
    print("这是func01结束")


# 定义一个无异常的函数，调用func01
def func02():
    print("这是func02开始")
    func01()
    print("这是func02结束")


# 定义一个没有捕获异常的函数
# def func03():
#     func02()


# func03()
"""
Traceback (most recent call last):
  File "F:\Python\Project\pythonStart\06-异常、模块与包\2.异常的传递性.py", line 20, in <module>
    func03()
  File "F:\Python\Project\pythonStart\06-异常、模块与包\2.异常的传递性.py", line 17, in func03
    func02()
  File "F:\Python\Project\pythonStart\06-异常、模块与包\2.异常的传递性.py", line 11, in func02
    func01()
  File "F:\Python\Project\pythonStart\06-异常、模块与包\2.异常的传递性.py", line 4, in func01
    num = 1 / 0
ZeroDivisionError: division by zero
"""


# 定义一个捕获异常的函数
def main():
    try:
        func02()
    except Exception as e:
        print(e)


main()
